﻿@{
    Bundle("jquery_validate");
}
           
<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('@ID("#form")').validate({
            rules: {
                parentID: {
                    required: true,
                    digits: true
                },
                displayOrder: {
                    required: true,
                    digits: true
                }
            }
        });
    });
</script>
<form id="@ID("form")" action="@Url.Action(Loc.Act("Update").Ctrl("Forum"))" method="post">
    <input type="hidden" name="flags" value="None" />
    <table>
        <tr>
            <td>
                <label>#</label>
            </td>
            <td>
                <input type="text" readonly name="id" value="@JDM.Int32(Model.EntityID)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>&#10001;</label>
            </td>
            <td>
            <input type="text" readonly value="@Svc.DateTime((DateTime)JDM.DateTime(Model.CreatedOn))" />
            </td>
        </tr>
        <tr>
            <td>
                <label>&#10002;</label>
            </td>
            <td>
            <input type="text" readonly value="@Svc.DateTime((DateTime)JDM.DateTime(Model.UpdatedOn))" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("TopicCount"))</label>
            </td>
            <td>
                <input type="text" readonly value="@JDM.Int32(Model.TopicCount)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("PostCount"))</label>
            </td>
            <td>
                <input type="text" readonly value="@JDM.Int32(Model.PostCount)" />
            </td>
        </tr>
        <tr>
            <td>
                @if(Model.LastTopic != null)
                {
                    <a href="@Url.Action(Loc.Act("Edit").Ctrl("Topic").Set(new
                    {
                        id = JDM.Int32(Model.LastTopic.EntityID)
                    }))" class="ui-icon ui-icon-extlink"></a>
                }
                <label>@T(Res.Name("LastTopic"))</label>
            </td>
            <td>
                <input type="text" readonly value="@(Model.LastTopic != null ? JDM.Int32(Model.LastTopic.EntityID) : 0)" />
            </td>
        </tr>
        <tr>
            <td>
                @if(Model.Parent != null)
                {
                    <a href="@Url.Action(Loc.Act("Edit").Ctrl("Forum").Set(new
                    {
                        id = JDM.Int32(Model.Parent.EntityID)
                    }))" class="ui-icon ui-icon-extlink"></a>
                }
                <label>@T(Res.Name("Parent"))</label>
            </td>
            <td>
                <input type="text" name="parentID" value="@(Model.Parent != null ? JDM.Int32(Model.Parent.EntityID) : 0)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("DisplayOrder"))</label>
            </td>
            <td>
                <input type="text" name="displayOrder" value="@JDM.Int32(Model.DisplayOrder)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("ForumFlags").Name("Active"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="Active" @(JDM.HasFlags(Model.Flags, "Active") ? "checked" : String.Empty) />
            </td>
        </tr>
    </table>
    <ul class="bar toolbar">
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>
